﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;

namespace BaseProject.Web.Controllers
{
    public class BaseController : Controller
    {
        public int CurrentPage
        {
            get
            {
                var page = 1;
                if (!string.IsNullOrEmpty(HttpContext.Request.Query["page"]))
                {
                    page = Convert.ToInt32(HttpContext.Request.Query["page"]);
                }
                else
                {
                    page = HttpContext.Session.GetInt32("CurrentPage") ?? 1;
                }
                return page;
            }
        }
    }
}